package com.looncin.oj.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.looncin.oj.model.entity.Files;
import com.looncin.oj.model.entity.UserAccessFile;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserAccessFilesMapper extends BaseMapper<UserAccessFile> {
    /**
     * 使用用户ID查询所有被授权的查看的表
     */
    @Select("SELECT * FROM user_to_files USE INDEX (idx_visitor_user_id) WHERE visitor_user_id = #{userId}")
    List<UserAccessFile> findFilesByVisitorUserIdWithIndex(@Param("userId") Long userId);
}
